home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / SourceCode / GameKit / Examples / NX_Invaders / NXIAlien.h < prev    next >
Encoding:
Text File  |  1995-06-12  |  1.2 KB  |  38 lines

  1.  
  2. // This object moves and renders the marching aliens.
  3.  
  4. #import <gamekit/gamekit.h>
  5.  
  6. // size of an alien (info about the .tiff NXImage):
  7. #define ALIEN_WIDTH        32
  8. #define ALIEN_HEIGHT    16
  9. #define ALIEN_WALK_FRAMES    2
  10. #define ALIEN_DIE_FRAMES    4
  11. #define ALIEN_FRAMES    ALIEN_DIE_FRAMES + ALIEN_WALK_FRAMES
  12.  
  13. // alien colors (for "series" instance variable)
  14. #define BLUE_ALIEN        2
  15. #define GREEN_ALIEN        1
  16. #define RED_ALIEN        0
  17.  
  18. // possible states (determine what we can do, etc.)
  19. #define ALIEN_ALIVE        (GK_DEAD_ACTOR + 1)
  20. #define ALIEN_DEAD        GK_DEAD_ACTOR
  21. #define ALIEN_DYING        (GK_DEAD_ACTOR + 2)
  22.  
  23. @interface NXIAlien:GKActor
  24. {
  25.     float screenWidth;    // set when the stage is assigned
  26.     id overseer;
  27. }
  28.  
  29. - init;    // Calls method below with semi-sane values...but you should use below:
  30. - initAlienColor:(int)col at:(NXPoint *)startPos ;    // init an alien
  31. - move:sender;            // decide where to move the ghost for the next frame
  32. - (BOOL)hitEdge:(int)anEdge;    // are we to the right/left edge yet?
  33. - leaveTheStage;        // overridden to let the overseer know when we leave
  34. - collidedWith:anActor;    // called when it is detected that we hit something
  35. - updateDrawingState;    // change the internal drawing state machine
  36.  
  37. @end
  38.